home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / hyphenator.h < prev    next >
Encoding:
C/C++ Source or Header  |  2007-07-10  |  3.2 KB  |  120 lines

  1. /*
  2. For general Scribus (>=1.3.2) copyright and licensing information please refer
  3. to the COPYING file provided with the program. Following this notice may exist
  4. a copyright and/or license notice that predates the release of Scribus 1.3.2
  5. for which a new license (GPL+exception) is in place.
  6. */
  7. #ifndef HYPLUG_H
  8. #define HYPLUG_H
  9.  
  10. #include <QObject>
  11. #include <QTextCodec>
  12. #include <QHash>
  13. #include <QSet>
  14.  
  15. #include "scribusapi.h"
  16. #include "hyphen.h"
  17. class ScribusDoc;
  18. class ScribusMainWindow;
  19. class PageItem;
  20.  
  21. /*!
  22. This class is the core of the Scribus hyphenation system.
  23. */
  24.  
  25. class SCRIBUS_API Hyphenator : public QObject
  26. {
  27.     Q_OBJECT
  28.  
  29. public:
  30.     /*!
  31.     \brief Constructor reads user configuration and sets hyphenator properties.
  32.     \date
  33.     \author Franz Schmid
  34.     \param parent unused
  35.     \param dok ScribusDoc reference. It's used for preferences accessing.
  36.     */
  37.     Hyphenator(QWidget* parent, ScribusDoc *dok);
  38.     /*!
  39.     \fn Hyphenator::~Hyphenator()
  40.     \brief Safely cleans hyphen. 
  41.     \date
  42.     \author Franz Schmid
  43.     */
  44.     ~Hyphenator();
  45.     
  46. private:
  47.  
  48.     /*! Embeded reference to the \see ScribusDoc filled by \a dok */
  49.     ScribusDoc *doc;
  50.     /*! Reference to the hyphen dictionary structure. */
  51.     HyphenDict *hdict;
  52.     /*! Flag - if is the dictionary without errors etc. If is it 'false'
  53.         hyphen aborted. */
  54.     bool useAble;
  55.     /*! Qt text codec which handles local characters. */
  56.     QTextCodec *codec;
  57.  
  58.     /*!
  59.         \brief Loads dictionary and fills parameters like \a useAble, \a codec, \a hdict.
  60.      \date
  61.      \author Franz Schmid
  62.      \param name is the name of specified language - filename.
  63.      */
  64.     void NewDict(const QString& name);
  65.     
  66. public:
  67.     /*! There are languages having rule not to hyphen word shorter than
  68.         MinWordLen */
  69.     int MinWordLen;
  70.     /*! Maximum number of hyphenations allowed following each other */
  71.     int HyCount;
  72.     /*! Language in use */
  73.     QString Language;
  74.     /*! Flag - if user set auto hyphen processing.*/
  75.     bool Automatic;
  76.     /*! Flag - obsolete? */
  77.     bool AutoCheck;
  78.     QHash<QString, QString> rememberedWords;
  79.     QHash<QString, QString> specialWords;
  80.     QSet<QString> ignoredWords;
  81.     
  82. public slots:
  83.     /*!
  84.     \brief Writes actual hyphen configuration into \a doc object.
  85.     \date
  86.     \author Franz Schmid
  87.     \param Wordlen lenght of the word.
  88.     \param Autom is automatic flag.
  89.     \param ACheck AutoCheck flag.
  90.     \param Num HyCount
  91.     */
  92.     void slotNewSettings(int Wordlen, bool Autom, bool ACheck, int Num);
  93.     /*! 
  94.     \brief Make hyphenation when user edits text in text frame manually.
  95.     If is everything set correctly and textframe selected language fits the
  96.     dictionary language. At first removes any old hyphens then sets new one.
  97.     \param it references \see PageItem - text frame.
  98.     \param text is a word to hyphenate.
  99.     \param firstC is the first character of the word in \a it item.
  100.     */
  101.     void slotHyphenateWord(PageItem* it, const QString& text, int firstC);
  102.     /*!
  103.     \brief Make hyphenation as described in \see slotHyphenateWord for the whole text frame.
  104.     \date
  105.     \author Franz Schmid
  106.     \param it references \see PageItem - text frame.
  107.     */
  108.     void slotHyphenate(PageItem *it);
  109.     /*!
  110.     \fn void Hyphenator::slotDeHyphenate(PageItem* it)
  111.     \brief Removes hyphenation either for the whole text frame or the selected text if there is a selection.
  112.     \date
  113.     \author Franz Schmid
  114.     \param it references \see PageItem - text frame.
  115.     */
  116.     void slotDeHyphenate(PageItem *it);
  117. };
  118.  
  119. #endif
  120.